home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Resources / Developers / XAMPP 1.5.4 / Windows installer / xampp-win32-1.5.4-installer.exe / xampp / contrib / ftp-mit-php.php < prev    next >
PHP Script  |  2006-04-18  |  1KB  |  51 lines

  1. <?php
  2. $host="localhost";
  3. $user="zaphod";
  4. $password="blabla";
  5.  
  6. // Herstellen der Basis-Verbindung
  7. $conn_id = ftp_connect($host); 
  8.  
  9. // Einloggen mit Benutzername und Kennwort
  10. $login_result = ftp_login($conn_id, $user, $password); 
  11.  
  12. // Verbindung ⁿberprⁿfen
  13. if ((!$conn_id) || (!$login_result)) { 
  14.         echo "Ftp-Verbindung nicht hergestellt!";
  15.         echo "Verbindung mit $host als Benutzer $user nicht m÷glich"; 
  16.         die; 
  17.     } else {
  18.         echo "Verbunden mit $host als Benutzer $user";
  19.     }
  20.  
  21. print "<br>";
  22. $path="/";
  23. $dir = "";
  24. ///// List  
  25. $files=ftp_nlist($conn_id, "$path");
  26. foreach ($files as $file) {
  27.  $isfile = ftp_size($conn_id, $file); 
  28.  if($isfile == "-1") { // Ist ein Verzeichnis
  29.   print $file."/ [DIR]<br>";
  30.  }
  31.  else {
  32.   $filelist[(count($filelist)+1)] = $file; // Ist eine Verzeichnis
  33.   print $file."<br>";
  34.  }
  35. }
  36.  
  37.  
  38. ///// Upload 
  39. // ftp_put($conn_id, $remote_file_path, $local_file_path, FTP_BINARY);
  40.  
  41. ///// Download
  42. // ftp_get($conn_id, $local_file_path, $remote_file_path, FTP_BINARY); 
  43.  
  44. ///// L÷schen einer Datei
  45. // ftp_delete ($conn_id, $remote_file_path); 
  46.  
  47.  
  48. // Schlie▀en des FTP-Streams
  49. ftp_quit($conn_id); 
  50. ?>
  51.